<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {string} s
 * @return {number}
 */
var longestPalindrome = function(s) {
	if(s==''){
		return 0;
	};
	s=s.split('').sort();
	var arr=[];
	var count=1;
	var res=s[0];
	for(var i=1;i<s.length;i++){
		if(res==s[i]){
			count++;
		}else{
			arr.push(count);
			res=s[i];
			count=1;
		};
	};
	arr.push(count);
	var aAronDie=false;
	count=0;
	for(var i=0;i<arr.length;i++){
		if(arr[i]%2==0){
			count+=arr[i];
		}else{
			count+=arr[i]-1;
			aAronDie=true;
		};
	};
	if(aAronDie){
		count++;
	};
    console.log(count);
    return count;
};
var res=new longestPalindrome("abccccdd");
</script>
</html>